package com.dk.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.dk.entity.DtSpecificationOption;
import com.dk.mapper.DtSpecificationOptionMapper;
import com.dk.service.IDtSpecificationOptionService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * <p>
 * 规格选项表 服务实现类
 * </p>
 *
 * @author author
 * @since 2021-12-22
 */
@Service
public class DtSpecificationOptionServiceImpl  implements IDtSpecificationOptionService {
    @Autowired
    private DtSpecificationOptionMapper mapper;

    @Override
    public IPage<DtSpecificationOption> getSpecOptions(Integer pageNum, Integer pageSize) {
        LambdaQueryWrapper<DtSpecificationOption> lambdaQueryWrapper = new LambdaQueryWrapper<>();
        IPage<DtSpecificationOption> page = new Page<>(pageNum,pageSize);
        IPage<DtSpecificationOption> page1 = mapper.selectPage(page, lambdaQueryWrapper);
        return page1;
    }

    @Override
    public void add(DtSpecificationOption option) {
        mapper.insert(option);

    }

    @Override
    public void delete(Long id) {
        mapper.deleteById(id);
    }

    @Override
    public void update(DtSpecificationOption option) {
        mapper.updateById(option);
    }
}
